package cn.icanci.controller.frontend;

import cn.icanci.entity.dto.MainPageInfoDTO;
import cn.icanci.entity.dto.Result;
import cn.icanci.service.combine.HeadLineShopCategoryCombineService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.simpleframework.core.annotation.Controller;
import org.simpleframework.inject.annotation.Autowired;
import org.simpleframework.mvc.annotation.RequestMapping;
import org.simpleframework.mvc.type.RequestMethod;

/**
 * 主页请求
 *
 * @author icanci
 * @date Created in 2021/02/04 00:10
 * @version 1.0
 */
@Controller
@RequestMapping(value = "/main")
public class MainPageController {
    @Autowired
    private HeadLineShopCategoryCombineService headLineShopCategoryCombineService;

    public HeadLineShopCategoryCombineService getHeadLineShopCategoryCombineService() {
        return headLineShopCategoryCombineService;
    }

    public void setHeadLineShopCategoryCombineService(HeadLineShopCategoryCombineService headLineShopCategoryCombineService) {
        this.headLineShopCategoryCombineService = headLineShopCategoryCombineService;
    }

    public Result<MainPageInfoDTO> getMainPageInfo(HttpServletRequest req, HttpServletResponse resp) {
        // TODO:参数检验和请求参数转换
        return headLineShopCategoryCombineService.getMainPageInfo();
    }

    @RequestMapping(value = "test", method = RequestMethod.GET)
    public void throwException() {
        System.out.println("MainPageController.throwException");
        System.out.println(1 / 0);
    }
}
